import matplotlib.pyplot as plt
from wordcloud import WordCloud

# 示例文本
text = """
Python is a widely used high-level programming language for general-purpose programming.
It emphasizes code readability with its notable use of significant whitespace.
Python supports multiple programming paradigms, including structured, object-oriented, and functional programming.
"""


wordcloud = WordCloud(
    width=800,
    height=400,
    background_color="white",
    max_words=100,
    colormap="viridis",
    stopwords={"the", "and", "is"},
).generate(text)


# 可视化
plt.figure(figsize=(10, 5))
plt.imshow(wordcloud, interpolation="bilinear")
plt.axis("off")
plt.title("词云图示例", fontsize=16)
plt.show()
